package com.zhanghe.study.springmvc.controller.exception;

import com.zhanghe.study.springmvc.exception.BusinessException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 基类，处理异常
 * @author zh
 * @date 2021/6/9 11:59
 */
@Controller
public class BaseController {
    @ExceptionHandler(BusinessException.class)
    @ResponseBody
    public String exception(Exception e){
        return "出现异常"+e.getMessage();
    }
}
